﻿<%@ Page Title="" EnableEventValidation="false" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ShoppingCart2.aspx.cs" Inherits="ShoppingCart" %>

<%@ Register assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div>

        <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="" 
            Height="16px"></dx:ASPxLabel>

        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            onrowcancelingedit="GridView1_RowCancelingEdit" 
            onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing" 
            onrowupdating="GridView1_RowUpdating" BackColor="White" 
            BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
            ForeColor="Black" GridLines="Vertical" Width="650px" >
            <RowStyle BackColor="#F7F7DE" />
            <Columns>
                <asp:TemplateField HeaderText="Hình">
                    <EditItemTemplate>
                        <asp:Image ID="Image1" runat="server" Height="95px" 
                            ImageUrl='<%# Eval("Thumbnail") %>' Width="71px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Image ID="Image1" runat="server" Height="98px" 
                            ImageUrl='<%# Eval("Thumbnail") %>' Width="73px" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên sách">
                    <EditItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("ProductName") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("ProductName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Đơn giá">
                    <EditItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("UnitPrice", "{0:N0}đ") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("UnitPrice", "{0:N0}đ") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Số lượng">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("Amount") %>' 
                            Width="30px" style="text-align: center"></asp:TextBox>
                        <asp:Label ID="Label5" runat="server" 
                            Text='<%# Eval("Remaining", "/{0} sản phẩm") %>'></asp:Label>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="TextBox1" ErrorMessage="*" 
                            SetFocusOnError="True">Nhập số lượng</asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="RangeValidator1" runat="server" 
                            ControlToValidate="TextBox1" ErrorMessage="*" 
                            MaximumValue='<%#Eval("Remaining")%>' MinimumValue="0" Type="Integer">Nhập theo giới hạn</asp:RangeValidator>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Amount") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tổng">
                    <EditItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("Total", "{0:N0}đ") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("Total", "{0:N0}đ") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ButtonType="Button" CancelText="Hủy" EditText="Sửa" 
                    ShowEditButton="True" UpdateText="Cập nhật" >
                <ControlStyle CssClass="Button" />
                </asp:CommandField>
                <asp:CommandField ButtonType="Button" DeleteText="Xóa" 
                    ShowDeleteButton="True" >
                <ControlStyle CssClass="Button" />
                </asp:CommandField>
            </Columns>
            <FooterStyle BackColor="#CCCC99" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <HeaderStyle Wrap="False" BackColor="#6B696B" Font-Bold="True" 
                ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        
        <asp:Label ID="ASPxLabel2" runat="server" Text="ASPxLabel">
        </asp:Label>
        <asp:Button ID="ASPxButton1" runat="server" Text="Xóa toàn bộ" 
            onclick="ASPxButton1_Click" CausesValidation="False" CssClass="Button"></asp:Button>
        <asp:Button ID="ASPxButton2" runat="server" Text="Đặt hàng" 
            onclick="ASPxButton2_Click" CssClass="Button"></asp:Button>
    </div>
</asp:Content>

